import { request } from '@pkg/request/src';

export enum Api {
  page = '/shop/page',
  list = '/shop/list',
  get = '/shop/get',
  add = '/shop/save',
  update = '/shop/update',
  remove = '/shop/remove',
  querySetWechat = '/shop/querySetWechat',
  setWechat = '/shop/setWechat',
  setIsShelf = '/shop/setIsShelf',
  setIsTop = '/shop/setIsTop',
  addShopAccount = '/shop/addShopAccount',
  setRecommend = '/shop/setRecommend',
  listByParentId = '/shop/type/listByParentId',
  all = '/shop/type/all',
  listByDictType = '/dictdata/listByDictType/shopPosition',
  shopSearchTag = '/dictdata/listByDictType/shopSearchTag',
}

export const shopList = (params) =>
  request.get(
    {
      url: Api.list,
      params: params,
    },
    { errorMessageMode: 'none', successMessageMode: 'none' },
  );

export const get = (id: string) =>
  request.get(
    { url: Api.get, params: { id: id } },
    {
      errorMessageMode: 'none',
      successMessageMode: 'none',
    },
  );

export const querySetWechat = (params) =>
  request.get(
    { url: Api.querySetWechat, params: params },
    {
      errorMessageMode: 'none',
      successMessageMode: 'none',
    },
  );
export const setWechat = (params) =>
  request.post(
    { url: Api.setWechat, params: params },
    {
      errorMessageMode: 'none',
      successMessageMode: 'success',
    },
  );
export const shopCateGoryList = (params) =>
  request.get(
    { url: Api.listByParentId ,params},
    {
      errorMessageMode: 'none',
      successMessageMode: 'none',
    },
  );

export const shopCateGoryAllList = (params) =>
  request.get(
    { url: Api.all ,params},
    {
      errorMessageMode: 'none',
      successMessageMode: 'none',
    },
  );



export const shopAccountSub = (params) =>
  request.post(
    { url: Api.addShopAccount, params: params },
    {
      errorMessageMode: 'none',
      successMessageMode: 'success',
    },
  );
